//
//  ViewController.m
//  STRequest
//
//  Created by yls on 13-12-10.
//  Copyright (c) 2013年 yls. All rights reserved.
//

#import "ViewController.h"
#import "STRequest.h"

#define SeverUrl @"http://localhost/~yls/sttest.php"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
	
    // 异步测试
    NSDictionary *params = @{@"name": @"xuezhang", @"age": @"26"};
    
    [STRequest sendAsynchronousRequestWithUrlString:SeverUrl params:params method:STRequestMethodGet completionHandler:^(NSString *responseString, NSDictionary *responseData, NSError *connectionError) {
        NSLog(@"%@", responseData);
        // 在这里处理返回结果
    }];
    
    // 同步测试
    NSDictionary *result = [STRequest sendSynchronousRequestWithUrlString:SeverUrl params:params method:STRequestMethodGet];
    // 打印返回结果
    NSLog(@"%@", result);
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
